package com.sh.data.engine.repository.dao.normalization.standard.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import com.sh.data.engine.repository.dao.base.EngineBaseModel;
import lombok.*;

/**
 * @author binghe
 * @email binghe.yxh@xuelangyun.com
 */
@EqualsAndHashCode(callSuper = true)
@NoArgsConstructor
@AllArgsConstructor
@TableName("tb_dictionary_mapping_report")
@Data
@Builder(toBuilder = true)
public class DictionaryMappingReportEntity extends EngineBaseModel<DictionaryMappingReportEntity> {

    /**
     * 项目id
     */
    private Long projectId;

    /**
     * 数据库id
     */
    private Long datasourceBaseId;

    /**
     * hive库tbls表id
     */
    private Long tblId;

    /**
     * 外部表表名称
     */
    private String tableName;

    /**
     * 表描述
     */
    private String tableDes;

    /**
     * 命中数量
     */
    private Integer hitCount;

    public Boolean checkIsHitCount() {
        return hitCount != null && 0 < hitCount;
    }

    public Boolean checkDisHitCount() {
        return hitCount != null && 0 == hitCount;
    }

    /**
     * 表字段数量
     */
    private Integer fieldCount;

    /**
     * 表字段详情json[{"fieldName":"id","comment":"自增id"}]
     */
    private String tableFieldJson;

    /**
     * 来源 0数据集成引擎
     */
    private Integer mapSource;

    /**
     * 删除状态 0删除 1未删除
     */
    @TableLogic(value = "1", delval = "0")
    private Integer rowState;

    /**
     * 库名
     */
    private String dbName;

    /**
     * jdbc链接
     */
    private String jdbcUrl;

    /** pg模式 */
    /**
     * schema
     */
    @TableField(value = "\"schema\"")
    private String schema;

    //  @Tolerate
    //  public DictionaryMappingReportEntity() {}
}
